Skip to content

Updates#1203

Merged
gilbarbara merged 3 commits intomainfrom
updates
Apr 1, 2026
Merged

Updates#1203
gilbarbara merged 3 commits intomainfrom
updates

Conversation

@gilbarbara
Copy link
Copy Markdown
Owner

@gilbarbara gilbarbara commented Apr 1, 2026

This pull request refactors and improves the codebase by enhancing the tracking of user interaction origins, simplifying spotlight logic, and reorganizing utility functions for better maintainability. The most significant changes include passing an origin parameter to navigation controls, moving utility functions to more appropriate modules, and simplifying spotlight state management. Below are the key changes grouped by theme:

User Interaction Tracking

  • Updated navigation controls (next, prev, etc.) in useControls, Tooltip, and TourRenderer to accept and propagate an origin parameter, allowing the system to track the source of user actions (e.g., button, keyboard, overlay). The Origin enum was also updated to include BUTTON_BACK. This change is reflected across components, hooks, types, and tests. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Spotlight and Overlay Logic

  • Simplified the logic for displaying the spotlight in the JoyrideOverlay component by replacing stateful management with a derived value based on the current lifecycle and placement, and removed related useEffect and state. [1] [2]

Refactoring and Utility Function Organization

  • Moved needsScrolling and shouldHideBeacon from helpers.tsx to more appropriate modules (dom.ts and step.ts respectively), improving separation of concerns. Updated all relevant imports. [1] [2] [3] [4] [5] [6] [7] [8] [9]

  • Moved the hexToRGB function from helpers.tsx to styles.ts, and updated imports in code and tests accordingly. [1] [2] [3]

Floating UI and Test Utilities

  • Updated the floating UI logic in JoyrideFloater to use the new elements property instead of refs, aligning with the latest floating UI API and improving code clarity. Adjusted related test mocks. [1] [2]

Copilot AI review requested due to automatic review settings April 1, 2026 00:22
@codesandbox
Copy link
Copy Markdown

codesandbox Bot commented Apr 1, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses React 18 aggressive batching issues by refactoring how Floating UI elements are referenced in JoyrideFloater and simplifying spotlight visibility logic in JoyrideOverlay, aiming to make tooltip/spotlight rendering more reliable.

Changes:

  • Updated JoyrideFloater to use tooltipFloating.elements when wiring autoUpdate, aligning with Floating UI’s elements-based API.
  • Simplified JoyrideOverlay spotlight visibility by computing showSpotlight directly instead of managing it via state/effects.
  • Updated the Floating UI test mock return shape to include the elements property.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/components/Floater.tsx Switches autoUpdate wiring to use tooltipFloating.elements to improve reliability under React 18 batching.
src/components/Overlay.tsx Replaces spotlight state/effect toggling with a direct showSpotlight computation.
test/components/Floater.spec.tsx Updates useFloating mock return to include the elements field expected by production code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/Overlay.tsx
Comment thread src/components/Floater.tsx
@gilbarbara gilbarbara changed the title Fix React 18 aggressive batching Updates Apr 1, 2026
- refactor spotlight visibility logic in Overlay
- update Floater autoUpdate effect
- move needsScrolling to modules/dom
- move shouldHideBeacon to modules/step
- move hexToRGB to styles
- add origin tracking to next() and prev()
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/modules/step.ts
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 1, 2026

@gilbarbara gilbarbara merged commit ee6aad3 into main Apr 1, 2026
9 checks passed
@gilbarbara gilbarbara deleted the updates branch April 1, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants